home *** CD-ROM | disk | FTP | other *** search
/ Amiga Tools 5 / Amiga Tools 5.iso / tools / dfÜ / bbs / aptbbs1 / apt / rexx / importtics.rexx < prev    next >
Encoding:
OS/2 REXX Batch file  |  1995-10-10  |  3.4 KB  |  116 lines

  1. /* importtics.rexx
  2. **
  3. ** $VER: importtics 0.0.1 (1.4.93)
  4. **
  5. ** ARexx program for controlling ApT-BBS by ApT-Design.
  6. **
  7. ** Copyright © 1993 ApT-Design All Rights Reserved
  8. **
  9. ** This script will do all of the importing of your .tic files. It
  10. ** will use the actual 'diverted' to defines that should have already
  11. ** been created within the Manager. You may also create your own
  12. ** log-charts to your own design which should give you some idea of
  13. ** what files came in during the session.
  14. **
  15. ** Optional Extras:
  16. **
  17. ** For people that wish to do additional 'CRC' checking you will find
  18. ** that you will be able to find the CRC and 'BodyName' + 'Inbound dir'
  19. ** name which will allow you to do your own archive testing before
  20. ** deciding to allow the file to be added to your system.
  21. **
  22. */
  23.  
  24. CR = 'A'x
  25.  
  26. tearline = "-----------------------------------------------------------------------------"
  27.  
  28. options results
  29. portname = 'APTMANAGER'
  30. address value portname
  31.  
  32. say CR CR "Scanning Tic directory...." CR
  33.  
  34. /*
  35. ** Some nice little left-margin error warning codes, better than all
  36. ** of those +, * and ! and whatever..
  37. **/
  38. LSTART = "|\/|"
  39. LOK    = "|OK|"
  40. LERR   = "|ER|"
  41. LEND   = "|/\|"
  42.  
  43. reportfile    =    "ram:tic.report"
  44. logfile         =    "ram:TicReport.Log"
  45.  
  46. if open('rfh',reportfile,'W') = 0 then do
  47.     'LOGWRITE' logfile "Failed to open '"reportfile"' for writing.."
  48.     exit
  49. end
  50.  
  51. /*
  52. ** START: we now start the actually running of the system, first writing
  53. ** to log that we have started our session..
  54. **/
  55. 'LOGWRITE' logfile LSTART
  56. 'LOGWRITE' logfile LOK "Tic Session Started..."
  57.  
  58. 'INITTICSCAN' 0
  59. if(result=1) THEN DO
  60.  
  61.     DO FOREVER
  62.         'FINDTIC'
  63.         if(result==0) THEN BREAK
  64.  
  65.         /*
  66.         ** Get all the information that may be
  67.         ** required to actually see us through
  68.         ** our tic session..
  69.         **/
  70.         'GETTICINFO' 0    ; area          = result /* original tic destination filearea     */
  71.         'GETTICINFO' 1    ; file          = result /* actual name of body-file                */
  72.         'GETTICINFO' 2    ; desc          = result /* description of file..                    */
  73.         'GETTICINFO' 3    ; ticfle      = result /* name of .tic file                            */
  74.         'GETTICINFO' 4    ; origin         = result /* Original Fido Origin of .tic & body    */
  75.         'GETTICINFO' 5    ; from          = result /* Origin of which Fido you received it*/
  76.         'GETTICINFO' 6    ; crc           = result /* CRC archiver code                            */
  77.         'GETTICINFO' 7    ; createdby  = result /* Version of Tic used to create .tic    */
  78.         'GETTICINFO' 8    ; divertedto = result /* Which dir it is being diverted to    */
  79.         'GETTICINFO' 9    ; inbounddir = result /* Inbound directory for .tic's            */
  80.  
  81.         /*
  82.         ** <filename>.ADS 'long file descriptions' have yet to be
  83.         ** implemented, we thus check to see if we have hit one
  84.         ** and if so we skip it, .. unless you wish to have the
  85.         ** file hit your system.. (some do..)
  86.         **/
  87.         if index(file,"ADS")=0 then do
  88.  
  89.             dummy = writeln('rfh',tearline)
  90.  
  91.             if(divertedto="") then dummy=writeln('rfh',">> AREA NOT DEFINED:" area)
  92.             else dummy = writeln('rfh',"Area: "area" -> "divertedto)
  93.             dummy = writeln('rfh',"File: "file)
  94.             dummy = writeln('rfh',"Desc: "desc)
  95.  
  96.             if(divertedto~="") then do
  97.                 'LOGWRITE' logfile LOK "Added File '"file"' to area '"divertedto"'"
  98.                 'ADDTIC'
  99.                 if(result=0) then 'LOGWRITE' logfile LERR "Failure to add: '"file"' to '"divertedto"'"
  100.             end
  101.             else 'LOGWRITE' logfile LERR "File '"file"' has no destination area '"area"'.."
  102.         end
  103.  
  104.     END
  105.  
  106. END
  107.  
  108. dummy = close('rfh')
  109.  
  110. 'LOGWRITE' logfile LOK "Tic Session ended..."
  111. 'LOGWRITE' logfile LEND
  112.  
  113. say CR "Finished...." CR
  114.  
  115. EXIT
  116.